import { IPSEditorContainerEx } from '../ipseditor-container-ex';
import { IPSDEFormItem } from './ipsdeform-item';
import { IPSDEFormItemEx } from './ipsdeform-item-ex';
import { PSDEEditFormItemImpl } from './psdeedit-form-item-impl';

export class PSDEEditFormItemExImpl extends PSDEEditFormItemImpl implements IPSDEFormItemEx, IPSEditorContainerEx {
  protected psdeformitems: IPSDEFormItem[] | null = null;

  getPSDEFormItems(): IPSDEFormItem[] | null {
    if (this.psdeformitems == null) {
      this.psdeformitems = this.fillChildListModel(this.M.getPSDEFormItems, 'control.form.IPSDEFormItem') as IPSDEFormItem[];
    }
    return this.psdeformitems;
  }

  get psDEFormItems(): IPSDEFormItem[] | null {
    return this.getPSDEFormItems();
  }

  findPSDEFormItem(objKey: any): IPSDEFormItem | null {
    return this.getPSModel5('control.form.IPSDEFormItem', this.getPSDEFormItems(), objKey) as IPSDEFormItem;
  }

  get compositeItem(): boolean {
    return this.M.compositeItem;
  }

  get cls(): string {
    return 'PSDEEditFormItemExImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSEditorContainerEx' || cls == 'control.form.IPSDEFormItemEx') return true;
    return super.instanceof(cls);
  }
}
